from selenium import webdriver
import unittest
from Mouth_examofzhuan5.Page.Page_one import Page_one
from ddt import ddt,file_data
from Mouth_examofzhuan5.Tools.have_log import have_log




@ddt
class Case(unittest.TestCase):
    def setUp(self) -> None:
        print('start case')
        self.driver=webdriver.Chrome()


    @file_data('data.yaml')
    def test_01(self,username,password,remark):
        have_log()
        page=Page_one(self.driver)
        page.open_url('https://www.jiuxian.com/')
        # 隐式等待
        self.driver.implicitly_wait(5)
        if remark==1:
            text = page.sp_addcar(username, password)
            self.assertEqual(text, 'jxw555923334')
            print('正例')
        else:
            page.fanli(username,password)
            print('反例')

    def tearDown(self) -> None:
        print('end case')
        self.driver.quit()






